#ifndef _JobManager_h_
#define _JobManager_h_
//#include "Queue.h"

#include "Job.h"

// Queue dependencies
#include <list>
#include <iostream>
#include <queue>
#include <deque>

// Threads
#include <boost/thread/thread.hpp>
#include <boost/thread/mutex.hpp>
#include <boost/thread/condition.hpp>
#include <boost/thread/xtime.hpp>


class JobManager {
private:
	// queue
	typedef boost::mutex::scoped_lock Lock;

	std::queue<Job> job_queue;
	unsigned int max_queue_size;
	
	bool done;
	// mutex/monitors
	boost::mutex monitor;
	boost::condition buffer_full, buffer_empty;

	//helpers 
	Job getJob();	
	
public:
	JobManager();
	JobManager(int size);
	//JobManager(const JobManager &other);
	void addJob(Job* job);
	void run();
	void finish();

	void operator() ();
};

#endif